package lazy;

public class StaticInnerSingleton {
        private StaticInnerSingleton(){
        }
        public static StaticInnerSingleton getInstance(){
            return SingletonHolder.sInstance;
        }
        //在调用getInstance的时候才初始化内部类，既实现了线程安全又实现了懒加载，同时避免了锁对性能的消耗
        private static class SingletonHolder {
            private static final StaticInnerSingleton sInstance = new StaticInnerSingleton();
        }
}
